<template>
  <tr>
    <td @change="Change">
      <input type="checkbox" v-model="show[index].isshow" />
    </td>
    <td>{{ name }}</td>
    <td>{{ price }}</td>
    <td>
      <button @click="dec">-</button> {{ num }} <button @click="add">+</button>
    </td>
    <td>{{ total }}</td>
    <td><button @click="Del">删除</button></td>
  </tr>
</template>

<script>
import EventBus from '../EventBus'
export default {
  props: ['name', 'price', 'num', 'index', 'total', 'show'],
  data() {
    return {
      data() {
        return {}
      },
    }
  },
  methods: {
    Del(index) {
      this.$emit('ChengeDel', this.index)
    },
    dec(index) {
      this.$emit('ChangeDec', this.index)
    },
    add(index) {
      this.$emit('ChangeAdd', this.index)
    },
    Change() {
      EventBus.$emit('ChangeHeji', this.index)
    },
  },
}
</script>

<style>
td {
  width: 220px;
}
table {
  text-align: center;
  width: 750px;
}
</style>
